package cn.wolfcode;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;

public class Demo02 {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        ArrayList<Integer> list=new ArrayList<>();
        list.add(1);

        list.getClass().getMethod("add",Object.class).invoke(list,"你好");

        for (int i = 0; i < list.size(); i++) {

            System.out.println(list.get(i));
        }
    }
}
